CFLAGS = -Wall -fpic -coverage -lm

all: testCardsUnit testCardsInteg testCoreUnit testInitializeGame testSystemComplete
	testCardsUnit all
	testCardsInteg all
	testCoreUnit all
	testInitializeGame
	testSystemComplete


rngs.o: rngs.h rngs.c
	gcc -c rngs.c -g  $(CFLAGS)

dominion.o: dominion.h dominion.c rngs.o
	gcc -c dominion.c -g  $(CFLAGS)

playdom: dominion.o playdom.c
	gcc -o playdom playdom.c -g dominion.o rngs.o $(CFLAGS)

interface.o: interface.h interface.c
	gcc -c interface.c -g  $(CFLAGS)

player: player.c interface.o
	gcc -o player player.c -g  dominion.o rngs.o interface.o $(CFLAGS)

clean:
	rm -f *.o *.*~ playdom.exe playdom player player.exe testCardsUnit testCardsInteg testCoreUnit testSystemComplete testInitializeGame results.out *.gcov *.gcda *.gcno *.so

### BEGIN RULES FOR UNIT TESTS OF CARDS. TO MAKE, USE COMMAND make testCardsUnit ####
cardUnitTestHelpers.o: cardUnitTestHelpers.c cardUnitTestHelpers.h dominion.o rngs.o
	gcc -c cardUnitTestHelpers.c $(CFLAGS)

fixedCardUnitTests.o: fixedCardUnitTests.c fixedCardUnitTests.h dominion.o rngs.o cardUnitTestHelpers.o
	gcc -c fixedCardUnitTests.c $(CFLAGS)

randomCardUnitTests.o: randomCardUnitTests.c randomCardUnitTests.h dominion.o rngs.o cardUnitTestHelpers.o
	gcc -c randomCardUnitTests.c $(CFLAGS)

testCardsUnit: testCardsUnit.c dominion.o rngs.o fixedCardUnitTests.o randomCardUnitTests.o cardUnitTestHelpers.o
	gcc -o testCardsUnit -g testCardsUnit.c dominion.o rngs.o fixedCardUnitTests.o randomCardUnitTests.o cardUnitTestHelpers.o $(CFLAGS)	
### END RULES FOR UNIT TESTS OF CARDS. TO MAKE, USE COMMAND make testCardsUnit ####

### BEGIN RULES FOR INTEGRATION TESTS OF CARDS.  TO MAKE USE COMMAND make testCardsInteg ###
testCardsInteg: testCardsInteg.c dominion.o rngs.o fixedCardUnitTests.o randomCardUnitTests.o cardUnitTestHelpers.o
	gcc -o testCardsInteg -g testCardsInteg.c dominion.o rngs.o fixedCardUnitTests.o randomCardUnitTests.o cardUnitTestHelpers.o $(CFLAGS)	

### BEGIN RULES FOR UNIT TESTS OF DOMINION CORE. TO MAKE, USE COMMAND make testCoreUnit ####
coreUnitTestHelpers.o: coreUnitTestHelpers.c coreUnitTestHelpers.h dominion.o rngs.o
	gcc -c coreUnitTestHelpers.c $(CFLAGS)

coreUnitTests.o: coreUnitTests.c coreUnitTests.h dominion.o rngs.o coreUnitTestHelpers.o
	gcc -c coreUnitTests.c $(CFLAGS)

testCoreUnit: testCoreUnit.c dominion.o rngs.o coreUnitTests.o coreUnitTestHelpers.o
	gcc -o testCoreUnit -g testCoreUnit.c dominion.o rngs.o coreUnitTestHelpers.o coreUnitTests.o $(CFLAGS)	

testInitializeGame: testInitializeGame.c dominion.o rngs.o coreUnitTestHelpers.o
	gcc -o testInitializeGame -g testInitializeGame.c dominion.o rngs.o coreUnitTestHelpers.o $(CFLAGS)

### END RULES FOR CORE UNIT TESTS. TO MAKE, USE COMMAND make testCoreUnit ####

### BEGIN RULES FOR SYSTEM TESTS ###

testSystemComplete: testSystemComplete.c dominion.o rngs.o
	gcc -o testSystemComplete -g testSystemComplete.c dominion.o rngs.o $(CFLAGS)

### END RULES FOR SYSTEM TESTS ###
